package com.example.graduate.Service.ServiceImpl;

import com.example.graduate.Bean.*;
import com.example.graduate.Service.ClientService;
import com.example.graduate.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service(value = "ClientService")
public class ClientServiceImpl implements ClientService {



    @Autowired
    private ClientMapper clientMapper;

    @Autowired
    private UserLoginMapper userLoginMapper;

    @Autowired
    private UserCollectiveMapper userCollectiveMapper;

    @Autowired
    private HistoryMapper historyMapper;

    @Autowired
    private StudyrecordMapper studyrecordMapper;

    @Autowired
    private CommunityCatetoryMapper  communityCatetoryMapper;

    @Autowired
    private PostMapper  postMapper;
    @Autowired
    private PaperquestionMapper  paperquestionMapper;

    @Autowired
    private PaperMapper paperMapper;

    @Autowired
    private WrongquestonMapper wrongquestonMapper;

    @Autowired
    private HistorylineMapper historylineMapper;

    @Autowired
    private  HistorycontentMapper historycontentMapper;

    @Autowired
    private  KnowledgeMapper knowledgeMapper;

    @Autowired
    private  Knowledge2Mapper knowledge2Mapper;

    @Autowired
    private  KnowledgearticleMapper knowledgearticleMapper;

    @Autowired
    private  MapcontentMapper mapcontentMapper;

    @Autowired
    private  MapinsideMapper mapinsideMapper;


    @Override
    public Client selectByPrimaryKey(Integer id) {
        return clientMapper.selectByPrimaryKey(id);
    }

    @Override
    public Client selectByOpenId(String openId) {
        return clientMapper.selectByOpenId(openId);
    }

    @Override
    public int insertSelective(Client record) {
        return clientMapper.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKeySelective(Client record) {
        return clientMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int checkSignDay(String id, Date start_time, Date end_time) {
        System.out.println(end_time);
        return userLoginMapper.checkSignDay("1",start_time,end_time);
    }

    @Override
    public Date selectLastDate(String id) {
        return userLoginMapper.selectLastDate(id);
    }

    @Override
    public Post selectPostById(Integer id) {
        return postMapper.selectPostById(id);
    }

    @Override
    public int insertSelective(Post record) {
        return postMapper.insertSelective(record);
    }

    @Override
    public CardsCollect getCollectiveById(String id) {
        return clientMapper.getCollectiveById(id);
    }

    @Override
    public void addCollective(UserCollective userCollective) {
        userCollectiveMapper.insert(userCollective);
    }

    @Override
    public int sign(UserLogin record) {
        return userLoginMapper.insert(record);
    }

    @Override
    public int insertHistory(History history) {
        return  historyMapper.insert(history);
    }

    @Override
    public List<History> selectHistoryById(Integer id) {
        return historyMapper.selectHistory(id);}

    @Override
    public List<Client> selectAll() {
        return clientMapper.selectAll();
    }

    @Override
    public List<Studyrecord>selectStudeyRecordByPrimaryKey(Integer id) {
        return studyrecordMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<CommunityCatetory> select() {
        return communityCatetoryMapper.select();
    }

    @Override
    public List<Post> selectPostByPrimaryKey(Integer id) {
        return postMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Paperquestion> selectPaperquestionByPaperId(String paperId) {
        return paperquestionMapper.selectByPrimaryKey(Integer.valueOf(paperId));
    }

    @Override
    public List<Paper> selectPaper() {
        return paperMapper.selectByPrimaryKey();
    }

    @Override
    public int insert(Wrongqueston record) {
        return wrongquestonMapper.insert(record);
    }

    @Override
    public List<Wrongqueston> selectByPrimaryKeys(Integer userid) {
        return wrongquestonMapper.selectByPrimaryKey(userid);
    }

    @Override
    public Paper selectById(Integer  id) {
        return paperMapper.selectById(id);
    }

    @Override
    public List<Wrongqueston> selectById(Integer userid, Integer paperId) {
        return wrongquestonMapper.selectById(userid,paperId);
    }

    @Override
    public Paperquestion selectPaperquestionById(Integer id) {
        return paperquestionMapper.selectById(id);
    }

    @Override
    public List<Historyline> selectAllHistoryLine() {
        return historylineMapper.selectAllHistoryLine();
    }

    @Override
    public List<Historycontent> selectHistoryContentByPrimaryKey(Integer id) {
        return historycontentMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Knowledge> selectByPrimaryKey() {
        return  knowledgeMapper.selectByPrimaryKey();
    }

    @Override
    public List<Knowledge2> select5ByPrimaryKey(Integer id) {
        return knowledge2Mapper.selectByPrimaryKey(id);
    }

    @Override
    public Knowledgearticle selectkonwByPrimaryKey(Integer id) {
        return knowledgearticleMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Mapcontent> selectMapByPrimaryKey() {
        return mapcontentMapper.selectByPrimaryKey();
    }

    @Override
    public Mapinside selectMapInsideByPrimaryKey(Integer id) {
        return mapinsideMapper.selectByPrimaryKey(id);
    }


}
